<?php

namespace app\kernel\queue\amqp;

use app\kernel\queue\amqp\message\Type;

/**
 * 消费者
 */
abstract class AbstractConsumer {

    /**
     * 默认链接
     * @var string
     */
    protected $connect = 'default';

    /**
     * 交换机
     * @var string
     */
    protected $exchange;

    /**
     * 队列名称
     * @var
     */
    protected $queue;

    /**
     * 交换机类型
     * @var string
     */
    protected $type = Type::DIRECT;


    /**
     * 路由
     * @var string
     */
    protected $routingKey;


    /**
     * @var bool
     */
    protected $requeue = false;


    /**
     * 消费队列
     * @param $msg
     * @return mixed
     */
    abstract public function consumer ($msg);

    /**
     * @return string
     */
    public function getConnect (): string {

        return $this->connect;
    }

    /**
     * @return string
     */
    public function getExchange (): string {

        return $this->exchange;
    }

    /**
     * @return mixed
     */
    public function getQueue () {

        return $this->queue;
    }

    /**
     * @return string
     */
    public function getType (): string {

        return $this->type;
    }

    /**
     * @return string
     */
    public function getRoutingKey (): string {

        return $this->routingKey;
    }

    /**
     * @return bool
     */
    public function isRequeue (): bool {

        return $this->requeue;
    }





}